/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.easoft.code.pos.util;

import com.easoft.code.pos.App;
import java.text.NumberFormat;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;

/**
 *
 * @author Eliu
 */
public class UIUtil {

    /**
     *
     * @param image
     * @return
     */
    public static ImageIcon getImage(String image) {
        return new javax.swing.ImageIcon(UIUtil.class.getResource("/images/" + image));
    }

    /**
     *
     * @param msg
     * @param title
     * @return
     */
    public static boolean confirm(String msg, String title) {
        int n = JOptionPane.showConfirmDialog(
                App.mainForm,
                msg,
                title,
                JOptionPane.YES_NO_OPTION);
        return n == JOptionPane.YES_OPTION;
    }

    /**
     *
     * @param error
     * @param title
     */
    public static void showError(String error, String title) {
        JOptionPane.showMessageDialog(App.mainForm,
                error,
                title,
                JOptionPane.ERROR_MESSAGE);
    }

    /**
     *
     * @param error
     * @param title
     */
    public static void showMsg(String error, String title) {
        JOptionPane.showMessageDialog(App.mainForm,
                error,
                title,
                JOptionPane.INFORMATION_MESSAGE);
    }

}
